﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;

namespace Draw.Core
{
    public abstract  class ElementBase : FrameworkElement
    {
        #region properties

        protected VisualCollection _children ;

        public Pen Pen { set; get; }

        public Brush Brush
        {
            set
            {
                Pen.Brush = value;
            }
            get
            {
                return Pen.Brush;
            }
        }

        public double ThicknessValue
        {
            set
            {
                Pen.Thickness = value;
            }
            get
            {
                return Pen.Thickness;
            }
        }

        #endregion


       

        #region pubblic methods

        public void Create()
        {
            Init();
        }

        #endregion

        #region protected methods

        protected abstract void Init();

        #endregion


        #region  override methods

        protected override Visual GetVisualChild(int index)
        {
            if (index < 0 || index >= _children.Count)
            {
                throw new ArgumentOutOfRangeException();
            }

            return _children[index];
        }

        protected override int VisualChildrenCount
        {
            get
            {
                return _children.Count;
            }
        }

        #endregion

        
    }
}
